package com.xixi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xixi.entity.Product;
import com.xixi.pojo.query.ProductQueryPage;
import com.xixi.pojo.vo.ProductVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    IPage<ProductVO> page(IPage<ProductVO> page, ProductQueryPage queryPage);

    ProductVO getProductById(@Param("productId") Integer id);
    @Select("select name from categories")
    List<String> getCategory();
    @Select("select id from categories where name=#{category}")
    Integer getCategoryIdByName(String category);
    @Select("select id from products where title=#{title}")
    Integer getIdByTitle(String title);
    @Select("select * from products")
    List<ProductVO> list();

    List<ProductVO> productListById(Integer id);
}
